package com.beverages.messages.client;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.beverages.messages.common.Result;
import com.beverages.messages.config.FeignOkHttpConfig;
import com.beverages.messages.entity.dto.intermediate.CancelOrderRequestDTO;
import com.beverages.messages.entity.dto.intermediate.RefundRequestDTO;
import com.beverages.messages.entity.intermediate.CancelOrderRequest;
import com.beverages.messages.entity.intermediate.RefundRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "customer-messages-service", url = "${customer.messages.service.url}", configuration = FeignOkHttpConfig.class)
public interface CustomerMessagesClient {

    @GetMapping("/customer/messages/request-for-refund/id/{requestId}")
    Result<RefundRequest> getRefundRequestById(@PathVariable("requestId") Integer requestId);

    @GetMapping("/customer/messages/request-for-refund/page/show-request-for-merchant")
    Result<Page<RefundRequestDTO>> pageShowCustomerRefundRequest(
            @RequestParam(name = "pageNum") Integer pageNum,
            @RequestParam(name = "pageSize") Integer pageSize,
            @RequestParam(name = "orderNumber", defaultValue = "") String orderNumber,
            @RequestParam(name = "whetherOnlyShowUnreplied", defaultValue = "true") Boolean whetherOnlyShowUnreplied);

    @GetMapping("/customer/messages/request-for-refund/be-replied")
    Result refundRequestIsReplied(@RequestParam(name = "requestId") Integer requestId,
                                   @RequestParam(name = "replyId") Integer replyId);

//    =================================================

    @GetMapping("/customer/messages/request-for-cancelling-order/id/{requestId}")
    Result<CancelOrderRequest> getCancelOrderRequestById(@PathVariable("requestId") Integer requestId);

    @GetMapping("/customer/messages/request-for-cancelling-order/page/show-request-for-merchant")
    Result<Page<CancelOrderRequestDTO>> pageShowCustomerCancelOrderRequest(
            @RequestParam(name = "pageNum") Integer pageNum,
            @RequestParam(name = "pageSize") Integer pageSize,
            @RequestParam(name = "orderNumber", defaultValue = "") String orderNumber,
            @RequestParam(name = "whetherOnlyShowUnreplied", defaultValue = "true") Boolean whetherOnlyShowUnreplied);

    @GetMapping("/customer/messages/request-for-cancelling-order/be-replied")
    Result cancelOrderRequestIsReplied(@RequestParam(name = "requestId") Integer requestId,
                                   @RequestParam(name = "replyId") Integer replyId);

}
